package com.cloudbroker.openapi.controller;

import com.cloudbroker.bcs.common.entity.HSBCPSBackVO;
import com.cloudbroker.bcs.common.util.VOUtil;
import com.cloudbroker.bcs.platform.dav.bizapi.service.base.vo.HSBCPSVO;
import com.cloudbroker.bcs.platform.dav.bizapi.t2service.business.ExtendAppGroupT2BizService;
import com.cloudbroker.bcs.platform.dav.common.ext.annotation.SaveLog;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import static com.cloudbroker.bcs.platform.dav.common.util.RequestUtil.getSingleParameterMapForBody;

@Controller
public class PlugsController {
    
    @Resource
    private ExtendAppGroupT2BizService extendAppGroupT2;
    
    @ResponseBody
    @RequestMapping("/func_init_broker_appandgroup")
    @SaveLog(remark = "dav组件数据 初始导入")
    public HSBCPSBackVO initBrokerAppAndGroup(HttpServletRequest request, String jsonpcallback){
        HSBCPSVO form = getSingleParameterMapForBody(request, HSBCPSVO.class);
        return VOUtil.setJsonpResult(extendAppGroupT2.funcInitBrokerAppAndGroup(form), jsonpcallback);
    }

    @ResponseBody
    @RequestMapping("/func_add_broker_appandgroup")
    @SaveLog(remark = "dav组件数据 添加应用")
    public HSBCPSBackVO addPlugsToBrokerAppGroup(HttpServletRequest request, String jsonpcallback){
        HSBCPSVO form = getSingleParameterMapForBody(request, HSBCPSVO.class);
        return VOUtil.setJsonpResult(extendAppGroupT2.funcAddPlugsToBrokerAppGroup(form), jsonpcallback);
    }
}
